<%@page import="model.bean.TourKind"%>
<%@page import="model.bean.TourTemp"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<head>
<style type = "text/css">
#main{
margin-top:15px;
float:left;
margin-left:100px;
overflow: hidden;
width:400px;
height: auto;
border: 1px solid #AC8853;
border-radius:5px;
}
.bag {
overflow: hidden;
height:auto;
}
#main *{
border-radius:5px;
border-color: #AC8853;
font-style: oblique;
font-family: Serif;
}
#main .lb {
width: 150px;
display:block;
float:left;
margin: 3px 3px 3px 3px;
line-height: 25px;
}
#main .ip {
width: 220px;
display:block;
float:left;
margin: 3px 3px 3px 3px;
line-height: 25px;
}
.tableTour {
width: auto;
display:block;
float:left;
margin: 3px 3px 3px 3px;
line-height: 25px;
border-radius: 5px;
border: 2px solid #AC8853;
font-style: oblique;
font-family: Serif;
}
.panel-body {
width:800px;
}
</style>
</head>
<jsp:include page="common/header.jsp"></jsp:include>
<div id="page-wrapper">
<div class="panel-body">

<h3> Daily Panel</h3>
<form method = "post" action = "${pageContext.request.contextPath}/TourUpdateServlet">
<div id = "main">
		<div class = "bag"><label class = "lb">Tên Tour Mẫu:</label><input id = "tourTempName" type = "text" name = "tourTempName" class = "ip" /></div>
	<div class = "bag"><label class = "lb">Loại Tour:</label><select  class = "ip" name = "tourKind" >
	<%
			String editImg = request.getContextPath()+"/manage_tour/images/user_edit.png";
	   		String delImg = request.getContextPath()+"/manage_tour/images/trash.png";
			ArrayList<TourKind> kind = null;
			kind = (ArrayList<TourKind>) 
					request.getAttribute("kind");
			if(kind != null) {
				for(int i = 0; i <kind.size(); i++){
	%>
	<option value = "<%= kind.get(i).getKindIndex() %>"><%=kind.get(i).getKindName() %></option>
	<%} 
		}%>
	</select></div>
	<div class = "bag"><label class = "lb">Giá tham khảo: </label><input class = "ip" type = "text" name = "tourPrice" /></div>
	<div class = "bag"><label class = "lb">Tần suất: </label><input class = "ip" type = "number" name = "usual" min = "0" max = "15" /></div>
	<%
 	String insertRs = null;
 	insertRs = (String) request.getAttribute("insertRs");
 	if ( insertRs != null){
	 	%>
	 	<script>alert("<%=insertRs %>")</script>
	 	<%
 	}
	
	%>
	<%
 	String updateRs = null;
	updateRs = (String) request.getAttribute("updateRs");
 	if ( updateRs != null){
	 	%>
	 	<script>alert("<%=updateRs %>")</script>
	 	<%
 	}
	
	%>
	
	<div class = "bag"><input type = "submit" id = "process" name = "process" value = "Add"/>
	<input type = "submit" name = "process" value = "Xem Tour Mau" /></div>
	<% 
	 	ArrayList<TourTemp> listTour = null;
     	listTour = (ArrayList<TourTemp>) request.getAttribute("listTour");
     	if(listTour != null){
    	 	
    	 	%>
    	 	</div>
    	 <table border = "1px" class = "tableTour">
    	 	<tr><th>Mã Tour Mẫu</th><th>Tên Tour mẫu</th>
    	 	<th>Mã Loại Tour</th><th>Gia Tham Khao</th><th>Tần Suất</th>
    	 	</tr>
    	 	<%
	  			for(int i = 0; i< listTour.size(); i++){
  				%>
  				<tr>
	  				<td><%=listTour.get(i).getTourTmpIndex()%></td>
  					<td><%=listTour.get(i).getTourTmpName() %></td>
  					<td><%=listTour.get(i).getTourTmpKind()%></td>
  					<td><%=listTour.get(i).getTourTmpPrice()%></td>
  					<td><%=listTour.get(i).getUsual()%></td>
  					<td><a href = "${pageContext.request.contextPath}/TourUpdateServlet?tourId=
  									<%=listTour.get(i).getTourTmpIndex()%>&process=Modify">
  									<image width = "20px" height = "15px" src = "<%=editImg %>"/></a></td>
	  				<td><a href = "${pageContext.request.contextPath}/TourUpdateServlet?tourId=
  									<%=listTour.get(i).getTourTmpIndex()%>&process=dailyLog">
  									<image width = "20px" height = "15px" src = "<%=delImg %>"/></a></td>
  				</tr>
  				<%
  				}
    	 	%>
    	 	</table>
    	 	
    	 	<%
     	}
	     
	%>
	</form>

	</div>
	<div>
	<%
		String dailyInsert = null;
	       	dailyInsert = (String) request.getAttribute("dailyInsert");
    	if (dailyInsert != null) {
	        %>
        	<script>alert("<%=dailyInsert%>");</script>
        	<%
    	}
	%>
	</div>
	</div>
	<jsp:include page="common/footer.jsp"></jsp:include>